import {createBrowserRouter} from 'react-router-dom'
import App from '../App'
import Login from '../page/login/Index'
import Index from '../page/index/Index'
import City from '../page/city/Index'




let router=createBrowserRouter([
    {
        path:'/',
        element:<App></App>,
        children:[
            {
                index:true,
                element:<Index></Index>
            },
            {
                path:"/index",
                lazy:async ()=>{
                    const {default:Index}=await import('../page/index/Index')
                    return{
                        element:<Index></Index>
                    }
                }
            },
            {
                path:"/two",
                lazy:async ()=>{
                    const {default:Two}=await import('../page/two/Index')
                    return{
                        element:<Two></Two>
                    }
                }
            },
            {
                path:"/three",
                lazy:async ()=>{
                    const {default:Three}=await import('../page/three/Index')
                    return{
                        element:<Three></Three>
                    }
                }
            },
        ]
    },{
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'/city',
        lazy:async ()=>{
            const {default:City,loader}=await import('../page/city/Index')
            return{
                element:<City></City>,
                loader
            }
        }
    },
    {
        path:'/citylist',
        lazy:async ()=>{
            const {default:Citylist,loader}=await import('../page/citylist/Index')
            return{
                element:<Citylist></Citylist>,
                loader
               
            }
        }
    }
])

export default router